﻿using System;
using System.Diagnostics;

namespace Runtime.Services.Battle.Entity {

    /// <summary>
    /// 战斗实体ID
    /// </summary>
    [DebuggerStepThrough]
    [DebuggerNonUserCode]
    public readonly struct DFR_BattleEntityID {

        /// <summary>
        /// 空值
        /// </summary>
        public static readonly DFR_BattleEntityID Empty = new() { Type = default, TableID = 0 };

        /// <summary>
        /// 表ID
        /// </summary>
        public int TableID { get; init; }

        /// <summary>
        /// 类型
        /// </summary>
        public DFR_BattleEntityType Type { get; init; }

        public override bool Equals(object obj) {
            if (obj is DFR_BattleEntityID other) {
                return Type == other.Type && TableID == other.TableID;
            }
            return false;
        }

        public override int GetHashCode() => HashCode.Combine(Type, TableID);

        public override string ToString() => $"[{nameof(DFR_BattleEntityID)}({nameof(Type)}={Type},{nameof(TableID)}={TableID})]";

        public static bool operator ==(DFR_BattleEntityID left, DFR_BattleEntityID right) => left.Equals(right);

        public static bool operator !=(DFR_BattleEntityID left, DFR_BattleEntityID right) => !left.Equals(right);
    }
}
